package x.y.z;

public class Interview_3_1_ThreeInOne {

}

class TripleInOne {
    private int[][] stack;
    private int[] tops;
    private int stackSize;

    public TripleInOne(int stackSize) {
        stack = new int[3][stackSize];
        tops = new int[]{-1, -1, -1};
        this.stackSize = stackSize;
    }

    public void push(int stackNum, int value) {
        if (tops[stackNum] < stackSize - 1) {
            tops[stackNum]++;
            stack[stackNum][tops[stackNum]] = value;
        }
    }

    public int pop(int stackNum) {
        if (tops[stackNum] > -1) {
            tops[stackNum]--;
            return stack[stackNum][tops[stackNum] + 1];

        }
        return -1;
    }

    public int peek(int stackNum) {
        if (tops[stackNum] > -1) {
            return stack[stackNum][tops[stackNum]];

        }
        return -1;
    }

    public boolean isEmpty(int stackNum) {
        return tops[stackNum] == -1;
    }
}
